package com.rbcs.repay.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.rbcs.borrow.model.Borrow;
import com.rbcs.reimb.model.Reimb;
import com.systop.common.modules.dept.model.Dept;
import com.systop.common.modules.security.user.model.User;
import com.systop.core.model.BaseModel;

/***
 * 还款申请表
 * @author ShangHua
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "repays")
public class RePay extends BaseModel {

	private Integer id;
	//还款单号
  private String singleNo;
  
	private String title;
	
	private Double amount;
	
	private User rePayer;

	private Date createDate;
	
	private String descn;
	
	private Borrow borrow;
	
	private Reimb reimb;
	
	private String type;

	private Dept dept;
	
	private User auditor;

	private Date audDate;
	
	private String audStatus;
	
	private String audDescn;

	@Id
	@GeneratedValue(generator = "hibseq")
	@GenericGenerator(name = "hibseq", strategy = "hilo")
	@Column(name = "id", nullable = false)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "rePayer_id")
  public User getRePayer() {
		return rePayer;
	}

	public void setRePayer(User rePayer) {
		this.rePayer = rePayer;
	}

	public String getSingleNo() {
		return singleNo;
	}

	public void setSingleNo(String singleNo) {
		this.singleNo = singleNo;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(precision = 10, scale = 2)
	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}
	
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getDescn() {
		return descn;
	}

	public void setDescn(String descn) {
		this.descn = descn;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "borrow_id")
	public Borrow getBorrow() {
		return borrow;
	}

	public void setBorrow(Borrow borrow) {
		this.borrow = borrow;
	}

	@OneToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "reimb_id")
	public Reimb getReimb() {
		return reimb;
	}

	public void setReimb(Reimb reimb) {
		this.reimb = reimb;
	}	
	
	@ManyToOne(cascade = {}, fetch = FetchType.EAGER)
	@JoinColumn(name = "dept_id")
	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
	}
	
	@Column(name = "type", columnDefinition = "char(1)")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "auditor_id")
	public User getAuditor() {
		return auditor;
	}

	public void setAuditor(User auditor) {
		this.auditor = auditor;
	}

	public Date getAudDate() {
		return audDate;
	}

	public void setAudDate(Date audDate) {
		this.audDate = audDate;
	}
	
	@Column(name = "aud_status")
	public String getAudStatus() {
		return audStatus;
	}

	public void setAudStatus(String audStatus) {
		this.audStatus = audStatus;
	}

	@Column(name = "aud_descn")
	public String getAudDescn() {
		return audDescn;
	}

	public void setAudDescn(String audDescn) {
		this.audDescn = audDescn;
	}
}
